package com.easy.service.impl;

import com.easy.bean.Administrator;
import com.easy.bean.User;
import com.easy.dao.AdministratorDao;
import com.easy.dao.UserDao;
import com.easy.service.IAdministratorService;
import com.easy.service.IShoppingLoginService;
import com.easy.service.ISystemLoginService;
import com.easy.util.SYS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SystemLoginService implements ISystemLoginService {
    @Autowired
    AdministratorDao administratorDao;
    @Override
    public boolean dologin(Administrator administrator) {
        Administrator admin=administratorDao.getAdministratorByAccount(administrator.getAccount());
        if(admin==null){
            return false;
        }else{
            if(SYS.checkPass(administrator.getPassword(),admin.getPassword())){
                administrator.setId(admin.getId());
                return true;
            }else{
                return false;
            }
        }
    }
}
